home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / radaranim.tsrx < prev    next >
Text File  |  1995-03-25  |  4KB  |  158 lines

  1. /* TextureStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* Constants */
  15.  
  16. PARAM_SWEEPANGLE = 2
  17.  
  18. address "TEXTURESTUDIO"
  19.  
  20. /* Bring TextureStudio's screen to the front */
  21.  
  22. SCREEN_FRONT
  23.  
  24. /* Stop input to windows */
  25.  
  26. GUI_BLOCK
  27.  
  28. /* Get user's texture path */
  29.  
  30. TEXTUREPATH_GET VAR 'texture_path'
  31.  
  32. /* Ask user to select radar texture */
  33.  
  34. REQUEST_FILE PATHPART '"'texture_path'"' FILEPART '"Radar.itx"',
  35.     PATTERN '"#?.itx"' TITLE '"Select Radar texture"' VAR 'texture_file'
  36.  
  37. /* Ask user for destination path */
  38.  
  39. REQUEST_DIR PATHPART '"Ram:"' TITLE '"Select destination directory"',
  40.     VAR 'dest_path'
  41.  
  42. /* Ask user to select number of frames */
  43.  
  44. REQUEST_MESSAGE TEXT '"Select the number of frames"',
  45.     BUTTONTEXT '"75|50|25|10"' VAR 'selected'
  46.  
  47. select
  48.     when selected = 0 then no_frames = 10
  49.     when selected = 1 then no_frames = 75
  50.     when selected = 2 then no_frames = 50
  51.     when selected = 3 then no_frames = 25
  52. end
  53.  
  54. /* Open selected texture and clear all others */
  55.  
  56. OPEN '"'texture_file'"' FLUSH
  57.  
  58. /* Set colours to give reasonable looking results */
  59.  
  60. COLOUR_SET OBJECTCOLOUR 0 0 0
  61. COLOUR_SET OBJECTFILTER 0 0 0
  62.  
  63. /* Map radar image into plane */
  64.  
  65. OBJECT_SET PLANE
  66.  
  67. /* Render each frame */
  68.  
  69. do frame = 1 to no_frames
  70.     angle = ( (frame - 1) / no_frames) * 360
  71.  
  72.     /* Set sweep angle */
  73.  
  74.     PARAMETER_SET PARAM_SWEEPANGLE angle
  75.  
  76.     /* Render screen in background */
  77.  
  78.     RENDER TOBACK
  79.  
  80.     /* Save out renderscreen */
  81.  
  82.     dest_filepart = 'Frame' || (frame + 99) || '.HAM'
  83.     FILE_JOIN PATHPART '"'dest_path'"',
  84.         FILEPART '"'dest_filepart'"' VAR 'dest_file'
  85.  
  86.     RENDERSCREEN_SAVE FILE '"'dest_file'"' FORCE
  87. end
  88.  
  89. /* Allow input back to windows */
  90.  
  91. GUI_UNBLOCK
  92.  
  93. /* END PROGRAM ***************************************************/
  94.  
  95. exit
  96.  
  97. /* On ERROR */
  98.  
  99. ERROR:
  100.  
  101. /* If we get here, either an error occurred with the command's */
  102. /* execution or there was an error with the command itself. */
  103. /* In the former case, rc2 contains the error message and in */
  104. /* the latter, rc2 contains an error number. SIGL contains */
  105. /* the line number of the command which caused the jump */
  106. /* to ERROR: */
  107.  
  108. if datatype(rc2,'NUMERIC') == 1 then do
  109.     /* See if we can describe the error with a string */
  110.  
  111.     select
  112.         when rc2 == 103 then
  113.             err_string = "ERROR 103, "||,
  114.                 "out of memory at line "||SIGL
  115.         when rc2 == 114 then
  116.             err_string = "ERROR 114, "||,
  117.                 "bad command template at line "||SIGL
  118.         when rc2 == 115 then
  119.             err_string = "ERROR 115, "||,
  120.                 "bad number for /N argument at line "||SIGL
  121.         when rc2 == 116 then
  122.             err_string = "ERROR 116, "||,
  123.                 "required argument missing at line "||SIGL
  124.         when rc2 == 117 then
  125.             err_string = "ERROR 117, "||,
  126.                 "value after keywork missing at line "||SIGL
  127.         when rc2 == 118 then
  128.             err_string = "ERROR 118, "||,
  129.                 "wrong number of arguments at line "||SIGL
  130.         when rc2 == 119 then
  131.             err_string = "ERROR 119, "||,
  132.                 "unmatched quotes at line "||SIGL
  133.         when rc2 == 120 then
  134.             err_string = "ERROR 120, "||,
  135.                 "line too long at line "||SIGL
  136.         when rc2 == 236 then
  137.             err_string = "ERROR 236, "||,
  138.                 "unknown command at line "||SIGL
  139.         otherwise
  140.             err_string = "ERROR "||rc2||" at line "||SIGL
  141.         end
  142.         end
  143. else if rc2 == 'RC2' then do
  144.     err_string = "ERROR in command at line "||SIGL
  145.     end
  146. else do
  147.         err_string = rc2||", line "||SIGL
  148.         end
  149.  
  150. say err_string
  151.  
  152. /* Unblock windows, just incase they are still blocked by the program being */
  153. /* terminated mid-way */
  154.  
  155. GUI_UNBLOCK
  156.  
  157. exit
  158.